Skip to content

fix(api): decode %2F in /servers/{id}/* path param via middleware (MCP-1118)#624

Merged
Dumbris merged 1 commit into
mainfrom
mcp-1118-decode-server-path-param
Jun 9, 2026
Merged

fix(api): decode %2F in /servers/{id}/* path param via middleware (MCP-1118)#624
Dumbris merged 1 commit into
mainfrom
mcp-1118-decode-server-path-param

Conversation

@Dumbris

@Dumbris Dumbris commented Jun 8, 2026

Copy link
Copy Markdown
Member

Problem

Official modelcontextprotocol/registry v0.1 server IDs are namespace/name (e.g. io.github.owner/repo). chi routes on RawPath, so the {id} path parameter of every /api/v1/servers/{id}/* sub-resource handler arrived percent-encoded (io.github.owner%2Frepo). This caused 404s for:

  • Web UI: Tools and Logs tabs on the server-detail page for slash-name servers
  • CLI: mcpproxy upstream logs, upstream restart, and other sub-resource commands

Same root cause as MCP-1056 (registry add-server slash ids, PR #591).

Fix

Add a decodeServerIDParam middleware to the /servers/{id} route group. It decodes the {id} param in the chi route context once, so every handler in the subtree (tools, logs, restart, approve, scan, tool-calls, …) receives the real name without each one needing an explicit decodePathParam call.

Also removes the now-redundant per-handler decodePathParam call from handleGetServerLogs (the only handler previously fixed individually).

Tests

  • TestServerSubresource_SlashServerIDUnescaped — new; covers tools, restart, and tool-calls endpoints with slash-encoded server ID
  • TestGetServerLogs_SlashServerIDUnescaped — existing; still passes

Closes #598

…P-1118)

All /api/v1/servers/{id}/* sub-resource handlers were receiving the raw
percent-encoded {id} param from chi (e.g. io.github.owner%2Frepo for a
slash-name official-registry server). This caused 404s for the Tools and
Logs tabs in the Web UI and for CLI sub-resource commands on slash-name
servers, since exact-match server lookups never found the encoded literal.

Fix: add decodeServerIDParam middleware to the /servers/{id} route group.
It decodes {id} in the chi route context once, so every handler in the
subtree (tools, logs, restart, approve, scan, …) receives the real name
without each one needing an explicit decodePathParam call.

Also remove the now-redundant per-handler decodePathParam in
handleGetServerLogs (was the only handler previously fixed individually).

Same root cause as MCP-1056 (registry add-server slash ids, PR #591).

Tests: TestServerSubresource_SlashServerIDUnescaped (tools/restart/tool-calls)
       TestGetServerLogs_SlashServerIDUnescaped (existing, still passes)
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6acf036
Status: ✅  Deploy successful!
Preview URL: https://d985fc92.mcpproxy-docs.pages.dev
Branch Preview URL: https://mcp-1118-decode-server-path.mcpproxy-docs.pages.dev

View logs

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

📦 Build Artifacts

Workflow Run: View Run
Branch: mcp-1118-decode-server-path-param

Available Artifacts

  • archive-darwin-amd64 (28 MB)
  • archive-darwin-arm64 (25 MB)
  • archive-linux-amd64 (16 MB)
  • archive-linux-arm64 (14 MB)
  • archive-windows-amd64 (28 MB)
  • archive-windows-arm64 (24 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (21 MB)
  • installer-dmg-darwin-arm64 (19 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 27156372175 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@mcpproxy-gatekeeper mcpproxy-gatekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gatekeeper approval — Codex review verdict: ACCEPT.

This approval is posted automatically by the MCPProxy Gatekeeper App on behalf of the Codex reviewer (verdict of record lives in the Paperclip review thread). Author≠approver satisfied; QA + CI gates enforced separately.

Auto-approved per Model B (MCP-1249).

@Dumbris Dumbris enabled auto-merge (squash) June 9, 2026 10:50
@Dumbris Dumbris merged commit bc03c56 into main Jun 9, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server names containing "/" (all official-registry names) are not percent-encoded → registry Add returns HTTP 400 and server-detail UI 404s

2 participants